<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                 xmlns="http://www.w3.org/1999/xhtml">
    <h:panelGrid xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
        <c:forEach items="#{knowledgeController.getResourceString(knowledgeController.getLearningResource(0,knowledgeController.selected))}" var="imageName">
            <img src="#{publicFields.fileRepository}knowledgeResources/image/#{imageName}" />
            <h:commandButton action="#{learningresourceController.deleteFiles(0, imageName)}" value="#{messages.Delete}"  class="buttonStyle" 
                             onclick="if (!confirm('#{messages.Delete}?'))
                                         return false" 
                             rendered="#{reexaminationController.isEditable(knowledgeController.selected, null)}" immediate="true"/>
        </c:forEach>
        <c:forEach items="#{learningresourceController.getVideos(knowledgeController.selected)}" var="item">
            <video  controls="controls">
                <source src="#{publicFields.fileRepository}knowledgeResources/video/#{item.key}" type="#{item.value}"></source>
            </video>
            <h:commandButton action="#{learningresourceController.deleteFiles(1, item.key, '#' ,item.value)}" value="#{messages.Delete}"   class="buttonStyle"
                             onclick="if (!confirm('#{messages.Delete}?'))
                                         return false" 
                             rendered="#{reexaminationController.isEditable(knowledgeController.selected, null)}" immediate="true"/>
        </c:forEach>
        <c:forEach items="#{knowledgeController.getResourceString(knowledgeController.getLearningResource(2,knowledgeController.selected))}" var="audioName">
            <audio controls="controls" >
                <source src="#{publicFields.fileRepository}knowledgeResources/audio/#{audioName}" 
                        type="audio/mpeg" />
                #{messages.DoesnotSAudio}
            </audio>
            <h:commandButton action="#{learningresourceController.deleteFiles(2, audioName)}" value="#{messages.Delete}"  class="buttonStyle"
                             onclick="if (!confirm('#{messages.Delete}?'))
                                         return false" 
                             rendered="#{reexaminationController.isEditable(knowledgeController.selected, null)}" immediate="true"/>
        </c:forEach>
        <c:forEach items="#{knowledgeController.getResourceString(knowledgeController.getLearningResource(3,knowledgeController.selected))}" var="pdfName">
            <embed src="#{publicFields.fileRepository}knowledgeResources/pdf/#{pdfName}" width="600px" height="100px" />
            <h:commandButton action="#{learningresourceController.deleteFiles(3, pdfName)}" value="#{messages.Delete}" style="width: 60px; height:40px; float:left; text-align: center;"
                             onclick="if (!confirm('#{messages.Delete}?'))
                                         return false" 
                             rendered="#{reexaminationController.isEditable(knowledgeController.selected, null)}" immediate="true"/>
        </c:forEach>
    </h:panelGrid>
</ui:composition>
